#include <iostream>
#include<cstdlib>
#include<vector>
#include<cmath>
#include <algorithm>
#include "distTree.h"

int main()
{
    size_t n;
    std::cin >> n;
    distTree<int> tree(n);
    std::string com = "NONE";
    while (com != "end")
    {
        std::cin >> com;
        if (com == "set")
        {
            size_t x, y;
            int v;
            std::cin >> x >> y >> v;
            tree.change(x, y, v);
        }
        else if (com == "get")
        {
            size_t x, y;
            std::cin >> x >> y;
            std::cout << "min on [" << x << ";" << y << "): " << tree.getMin(x, y) << "\n";
        }
        else if (com == "help")
        {
            std::cout << "\tset a b v\t- every value on [a;b) changed on v\n"
                      << "\tget a b\t- return min on [a;b)\n"
                      << "\tout\t- print on scrin all values\n"
                      << "\tend\t- last command\n";
        }
        else if (com == "out")
        {
            //for (size_t i = 0; i < n; ++i)
              //  std::cout << "|" << i;
            //std::cout << "|\n";
            for (size_t i = 0; i < n; ++i)
                std::cout << " " << tree.getMin(i, i + 1);
            std::cout << "\n";
        }
    }
    return 0;
}
